﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace Stockholm.SOA.Kaskelot.WCF.DataContracts
{
    [DataContract(Namespace = "http://stockholm.se/SOA/Kaskelot/KaskelotService/1/", Name = "Falt")]
    public class Falt
    {
        [DataMember]
        public Guid Id { get; set; }
        [DataMember]
        public Guid ValId { get; set; }
        [DataMember]
        public string Namn { get; set; }
        [DataMember]
        public FaltTyp Typ { get; set; }
        [DataMember]
        public string Default { get; set; }
        [DataMember]
        public bool Required { get; set; }

        public override bool Equals(object obj)
        {
            Falt otherFalt = obj as Falt;

            if (!this.Id.Equals(otherFalt.Id))
                return false;

            if (!this.ValId.Equals(otherFalt.ValId))
                return false;

            if (!this.Namn.Equals(otherFalt.Namn))
                return false;

            if (!this.Typ.Equals(otherFalt.Typ))
                return false;

            if (!this.Default.Equals(otherFalt.Default))
                return false;

            if (!this.Required.Equals(otherFalt.Required))
                return false;

            return true;
        }

        public override int GetHashCode()
        {
            int hash = 13;
            hash = (hash * 7) + Id.GetHashCode();
            hash = (hash * 7) + ValId.GetHashCode();
            hash = (hash * 7) + Namn.GetHashCode();
            hash = (hash * 7) + Typ.GetHashCode();
            hash = (hash * 7) + Default.GetHashCode();
            hash = (hash * 7) + Required.GetHashCode();
            return hash;
        }
    }
}
